package com.owen.client.ui.widget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.owen.client.UIFactoryInstance;
import com.owen.client.ui.ClassEditorPresenter.Display;
import com.owen.shared.events.EditClassEvent;

public class ClassEditor extends Composite implements Display {

	private static ClassEditorUiBinder uiBinder = GWT
			.create(ClassEditorUiBinder.class);

	interface ClassEditorUiBinder extends UiBinder<Widget, ClassEditor> {
	}

	@UiField
	Label title;
	
	@UiField
	Button submit;
	
	@UiField
	TextBox classId;
	
	@UiField
	TextBox className;

	public ClassEditor() {
		initWidget(uiBinder.createAndBindUi(this));
		title.setText("");
		this.setVisible(false);
	}

	@Override
	public String getClassId() {
		return classId.getText();
	}

	@Override
	public String getClassName() {
		return className.getText();
	}

	@Override
	public void setClassId(String author) {
		this.classId.setValue(author);
		
	}

	@Override
	public void setClassName(String publisher) {
		this.className.setValue(publisher);
		
	}

	@Override
	public void setTitle(String title) {
		this.title.setText(title);
		
	}
	
	@Override
	public String getTitle() {
		return title.getText();
		
	}

	@Override
	public Button getSubmit() {
		return submit;
	}

	@Override
	public void clearAll() {
		title.setText("");
		classId.setValue("");
		className.setValue("");
		
	}	
	

}
